package org.footballmanager.pandafootball.system.controller;

import org.footballmanager.pandafootball.common.constants.Constants;
import org.footballmanager.pandafootball.system.domain.FootDj;
import org.footballmanager.pandafootball.system.service.impl.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

@Controller
@RequestMapping("/foot/footDj")
public class FootDjController {
	/* 实体名称 */
	private static final String ENTITYNAME = "footDj";
	private static final String LISTPAGE = String.format(Constants.LISTPAGE, Constants.FOOT, ENTITYNAME);

	@Autowired
	private RedisService redisService;

	@RequestMapping(value="/search", method= RequestMethod.GET)
    @SuppressWarnings("unchecked")
    public String search(Model map) {
        List<FootDj> list = (List<FootDj>)redisService.get("listdj");
        map.addAttribute(String.format(Constants.LISTENTITY, ENTITYNAME), list);
		return LISTPAGE;
	}
}
